<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>相对单位</title>
</head>
<style>
  .one {
    font-size: 20px;
  }
  .two {
    font-size: 35px;
  }
  html {
    font-size: 10px;
  }
  .one .parent {
    height: 100px;
    width: 100px;
    border: 1px solid #333;
    font-size: 1em;
  }
  .one .son {
    height: 50px;
    width: 50px;
    border: 1px solid #333;
    font-size: 1em;
  }


  .two .parent {
    height: 100px;
    width: 100px;
    border: 1px solid #333;
    font-size: 1rem;
  }
  .two .son {
    height: 50px;
    width: 50px;
    border: 1px solid #333;
    font-size: 1rem;
  }

  .inner {
    height: 30px;
    background-color: red;
    width: 30%;
  }
</style>
<body>
  <div class="one">
    <div class="parent">
      父元素
      <div class="son">子元素</div>
    </div>
  </div>

  <div class="two">
    <div class="parent">
      父元素
      <div class="son">子元素</div>
    </div>
  </div>
  

  <div class="wrap">
    <div class="inner"></div>
  </div>
</body>
</html>